import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import CakeView from '../views/CakeView.vue'
import PersonalView from '../views/PersonalView.vue'
import OrderView from '../views/OrderView.vue'
import LoginView from '../views/LoginView.vue'
import RegisterView from '../views/RegisterView.vue'
import ProductListView from '../views/ProductListView.vue'
import ProductDetailView from '../views/ProductDetailView.vue'
import CartView from '../views/CartView.vue'
import PerinfoView from '../views/PerinfoView.vue'
import AddressView from '../views/AddressView.vue'
import ChangepwdView from '../views/ChangepwdView.vue'
import PercomView from '../views/PercomView.vue'
import NavProductListView from '../views/NavProductListView.vue'
import NavView from '../views/NavView.vue'
import CommentView from '../views/CommentView.vue'
import HotView from '../views/HotView.vue'
import PayView from '../views/PayView.vue'
import MyorderView from '../views/MyorderView.vue'
import ChangeAddressView from '../views/ChangeAddressView.vue'
import AddAddressView from '../views/AddAddressView.vue'
import ChaInfoView from '../views/ChaInfoView.vue'


Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'home',
    component: HomeView,
  },
  
  {
    path: '/Cake',
    name: 'Cake',
    component: CakeView,
    children:[
      {
        path: '/Nav',
        name: 'Nav',
        component: NavView
      }
    ]
  },
  {
    path: '/personal',
    name: 'personal',
    component: PersonalView,
    children:[
      {path:'perinfo',name:'perinfo',component:PerinfoView},
      {path:'ChaInfo',name:'ChaInfo',component:ChaInfoView},
      {path:'address',name:'address',component:AddressView,

    },
      {path:'changepwd',name:'changepwd',component:ChangepwdView},
      {path:'percom',name:'percom',component:PercomView},
      {path:'myorder',name:'myorder',component:MyorderView},
    ]
  },
  {
    path: '/setOrder',
    name: 'setOrder',
    component: OrderView,
    meta:{
      loginRequest:true
    }
  },
  {
    path: '/addaddress',
    name: 'addaddress',
    component: AddAddressView
  },
  
  {
    path: '/ProductList',
    name: 'ProductList',
    component: ProductListView,
  },
  {
    path: '/Login',
    name: 'Login',
    component: LoginView
  },
  {
    path: '/detail',
    name: 'detail',
    component: ProductDetailView 
  },
  {
    path: '/register',
    name: 'register',
    components: {
      default: RegisterView,
      'headnav': null
    }
  },
  
  {
    path: '/cart',
    name: 'cart',
    component: CartView,
    meta:{
      loginRequest:true
    }
  },
  {
    path: '/pay',
    name: 'pay',
    component: PayView
  },
  {
    path: '/HotView',
    name: 'HotView',
    component: HotView
  },
{
    path:'/NavProductList',
    name: 'NavProductList',
    component:NavProductListView
  }
  // {
  //   path: '/Nav',
  //   name: 'Nav',
  //   component: NavView
  // },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
